import { BaseWindow } from "../../../../component/window/BaseWindow";
import { ObjCreate } from "../../common/ObjCreate";
import { Lv70DramaConfig } from "../../../resource/Lv70DramaConfig";
import { MsgManager } from "../../../manager/MsgManager";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { GTextInput } from "../../../../../com/mui/controls/GTextInput";
import { GButton } from "../../../../../com/mui/controls/GButton";
//class Lv70DramaChoosePanel
    
    export  class Lv70DramaChoosePanel extends BaseWindow
    {
        constructor()
        {
            super();
            this.setSize(600, 400);
            this.initView();
            return;
        }

        /* internal  */initView(): void
        {
            var loc1=ObjCreate.createLabel("章节:", 30, 70, 30, 25, flash.text.TextFormatAlign.LEFT, this);
            this._txtChapter = ObjCreate.createGTextInput(loc1.x + loc1.width, loc1.y, 100, 20, this);
            this._txtChapter.text = "1";
            loc1 = ObjCreate.createLabel("第几层:", 28, 110, 45, 25, flash.text.TextFormatAlign.LEFT, this);
            this._txtFloor = ObjCreate.createGTextInput(loc1.x + loc1.width, loc1.y, 100, 20, this);
            this._txtFloor.text = "1";
            loc1 = ObjCreate.createLabel("难度:", 28, 140, 45, 25, flash.text.TextFormatAlign.LEFT, this);
            this._txtDifficulty = ObjCreate.createGTextInput(loc1.x + loc1.width, loc1.y, 100, 20, this);
            this._txtDifficulty.text = "1";
            loc1 = ObjCreate.createLabel("看剧情输入1不看输入0:", 28, 180, 200, 25, flash.text.TextFormatAlign.LEFT, this);
            this._txtDrama = ObjCreate.createGTextInput(28, loc1.y + 14, 100, 20, this);
            this._txtDrama.text = "1";
            this._btn = ObjCreate.createGButton("可选剧情进入副本", 60, 260, 60, 25, this);
            this._btnOut = ObjCreate.createGButton("退出副本", 180, 260, 60, 25, this);
            this._btn.addEventListener(flash.events.MouseEvent.CLICK, this.inHandler);
            this._btnOut.addEventListener(flash.events.MouseEvent.CLICK, this.outHandler);
            return;
        }

        /* internal  */inHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=parseInt(this._txtChapter.text);
            var loc2=parseInt(this._txtFloor.text);
            var loc3=parseInt(this._txtDifficulty.text);
            var loc4;
            var loc5=(loc4 = parseInt(this._txtDrama.text)) != 1 ? false : true;
            var loc6;
            if ((loc6 = Lv70DramaConfig.instance.getDramaCopy(loc1, loc3, loc2)) == null) 
            {
                MsgManager.showRollTipsMsg("进入的副本不存在");
                return;
            }
            Lv70DramaConfig.instance.curCopy = loc6;
            Dispatcher.dispatchEvent(new DataEvent(EventName.Lv70DramaEnterDrama, {"config": loc6, "isDrama": loc5}));
            return;
        }

        /* internal  */outHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.Lv70DramaLeaveDrama));
            return;
        }

        /* internal */ /* var */_txtChapter: GTextInput;

        /* internal */ /* var */_txtFloor: GTextInput;

        /* internal */ /* var */_txtDifficulty: GTextInput;

        /* internal */ /* var */_txtDrama: GTextInput;

        /* internal */ /* var */_btn: GButton;

        /* internal */ /* var */_btn2: GButton;

        /* internal */ /* var */_btnOut: GButton;
    }
